import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { BaseService } from '@wwjCommon/base/base.service';
import { CacheService } from '@wwjCommon/cache/cache.service';
import { LoggingService } from '@wwjCommon/logging/logging.service';
import { UploadService } from '@wwjVendor/upload/upload.service';
import { PayService } from '@wwjVendor/pay/pay.service';
import { SmsService } from '@wwjVendor/sms/sms.service';
import { NoticeService } from '@wwjVendor/notice/notice.service';

@Injectable()
export class TransferService extends BaseService<any> {
  private readonly logger = new Logger(TransferService.name);

  constructor(
    @InjectRepository(Object)
    protected readonly repository: Repository<any>,
    private readonly cacheService: CacheService,
    private readonly configService: ConfigService,
    private readonly loggingService: LoggingService,
    private readonly uploadService: UploadService,
    private readonly payService: PayService,
    private readonly smsService: SmsService,
    private readonly noticeService: NoticeService,
  ) {
    super(repository);
  }

  /**
   * getWechatTransferScene
   * 对应 PHP: TransferService_admin::getWechatTransferScene()
   * 逻辑类型: undefined - undefined
   */
  async getWechatTransferScene() {
    // 基于PHP真实逻辑: getWechatTransferScene
    // PHP原文: return (new CoreTransferSceneService())->getWechatTransferScene($this->site_id);     }      /**      * 设置转账场景id      * @param $scene      * @param $da...
return this.coreTransferSceneService.getWechatTransferScene(this.site_id);
    }

    /**
     * 设置转账场景id
     * @param scene
     * @param data
     * @return true
     */
    async setSceneId(scene, data){
        const core_transfer_service = this.coreTransferSceneService;
        const config = core_transfer_service.getWechatTransferSceneConfig(this.site_id) || [];
        const scene_list = TransferDict.getWechatTransferScene(];
        if(!scene_list[scene))) throw new AdminBusinessException('MERCHANT_TRANSFER_SCENARIOS_THAT_DO_NOT_EXIST'];
        config[scene] = data.scene_id;
        core_transfer_service.setWechatTransferSceneConfig(this.site_id, config);
        return true;
    }

    /**
     * 设置业务转账场景配置
     * @param type
     * @param data
     * @return true
     */
    async setTradeScene(type, data){
        const core_transfer_service = this.coreTransferSceneService;
        core_transfer_service.setTradeScene(this.site_id, type, data);
        return true;
    }
}
  }

  /**
   * setSceneId
   * 对应 PHP: TransferService_admin::setSceneId()
   * 逻辑类型: undefined - undefined
   */
  async setSceneId(scene: any, data: any) {
    // 基于PHP真实逻辑: setSceneId
    // PHP原文: $core_transfer_service = new CoreTransferSceneService();         $config = $core_transfer_service->getWechatTransferSceneConfig($this->site_id) ?? [];...
const core_transfer_service = this.coreTransferSceneService;
        const config = core_transfer_service.getWechatTransferSceneConfig(this.site_id) || [];
        const scene_list = TransferDict.getWechatTransferScene(];
        if(!scene_list[scene))) throw new AdminBusinessException('MERCHANT_TRANSFER_SCENARIOS_THAT_DO_NOT_EXIST'];
        config[scene] = data.scene_id;
        core_transfer_service.setWechatTransferSceneConfig(this.site_id, config);
        return true;
    }

    /**
     * 设置业务转账场景配置
     * @param type
     * @param data
     * @return true
     */
    async setTradeScene(type, data){
        const core_transfer_service = this.coreTransferSceneService;
        core_transfer_service.setTradeScene(this.site_id, type, data);
        return true;
    }
}
  }

  /**
   * setTradeScene
   * 对应 PHP: TransferService_admin::setTradeScene()
   * 逻辑类型: undefined - undefined
   */
  async setTradeScene(type: any, data: any) {
    // 基于PHP真实逻辑: setTradeScene
    // PHP原文: $core_transfer_service = new CoreTransferSceneService();         $core_transfer_service->setTradeScene($this->site_id, $type, $data);         return t...
const core_transfer_service = this.coreTransferSceneService;
        core_transfer_service.setTradeScene(this.site_id, type, data);
        return true;
    }
}
  }
}
